package com.guanyong.admin.controllers.api;

import com.guanyong.services.VideoCountService;
import com.guanyong.utils.Comm.ResultObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;

/**
 * Created by mxk on 2017/6/26.
 */
@RestController
@RequestMapping("/api/videolog/")
public class VideoLog {

    @Autowired
    VideoCountService videoCountService;

    //获取我的浏览记录
    @RequestMapping(value = "geuserplaylog", method = RequestMethod.GET)
    public ResultObject<HashMap<String,Object>> GetMyPlaylog(HttpServletRequest request,
                                                             @RequestParam String userid,
                                                             @RequestParam int pno,
                                                             @RequestParam int pagesize,
                                                             @RequestParam int allcount){
        HashMap<String,Object> objectHashMap= videoCountService.GetPlayList(userid,null,-1,
                (pno-1)*pagesize,
                pagesize,allcount);
        ResultObject<HashMap<String,Object>> resultObject=new ResultObject<HashMap<String, Object>>();
        if (objectHashMap!=null){
            resultObject.setResult(objectHashMap);
        }
        return  resultObject;
    }

    //获取我的收藏
    @RequestMapping(value = "getusercollectlog", method = RequestMethod.GET)
    public ResultObject<HashMap<String,Object>> GetMyCollectlog(HttpServletRequest request,
                                                                @RequestParam String userid,
                                                                @RequestParam int pno,
                                                                @RequestParam int pagesize,
                                                                @RequestParam int allcount){
        HashMap<String,Object> objectHashMap= videoCountService.GetCollectList(userid,pno,
                pagesize,allcount);
        ResultObject<HashMap<String,Object>> resultObject=new ResultObject<HashMap<String, Object>>();
        if (objectHashMap!=null){
            resultObject.setResult(objectHashMap);
        }
        return  resultObject;
    }

}


